Skip to content

fix(pto): infer matmul tile config by target arch#260

Open
HecreReed wants to merge 4 commits intozhangstevenunity:mainfrom
HecreReed:codex/auto-infer-matmul-tile-config
Open

fix(pto): infer matmul tile config by target arch#260
HecreReed wants to merge 4 commits intozhangstevenunity:mainfrom
HecreReed:codex/auto-infer-matmul-tile-config

Conversation

@HecreReed
Copy link
Contributor

@HecreReed HecreReed commented Mar 13, 2026

Summary

  • add a dedicated pto-infer-tile-config pass that derives LEFT/RIGHT/ACC tile config from pto.target_arch
  • run the pass before PTOViewToMemref so emitted pointer_cast/bind_tile metadata matches the target ISA on both A3 and A5
  • add A3/A5 regression tests as .pto inputs that lock the generated Tile<...> templates for matmul operands/results

Why

  • PTO-ISA expects different canonical LEFT tile layout on A3 vs A5, while RIGHT/ACC also need fixed fractal/layout combinations
  • keeping this inference in PTO IR removes the need for users to hand-thread BLayout/SLayout into matmul tiles
  • this also prevents low-level lowering from carrying stale default configs into generated C++

Testing

  • ninja -C build-llvm19 ptoas
  • build-llvm19/tools/ptoas/ptoas --pto-arch=a3 test/basic/matmul_tile_config_infer_a3.pto | /opt/homebrew/opt/llvm@19/bin/FileCheck test/basic/matmul_tile_config_infer_a3.pto
  • build-llvm19/tools/ptoas/ptoas --pto-arch=a5 test/basic/matmul_tile_config_infer_a5.pto | /opt/homebrew/opt/llvm@19/bin/FileCheck test/basic/matmul_tile_config_infer_a5.pto

@HecreReed HecreReed force-pushed the codex/auto-infer-matmul-tile-config branch from 9481541 to 01f8be4 Compare March 13, 2026 08:18
@HecreReed HecreReed marked this pull request as ready for review March 14, 2026 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant